import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
// 导入Pinia
import { createPinia } from 'pinia'
// 导入elementPlus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 导入router
import router from './router'
import VMdEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';
import Permission from './permission/permission.js'
import {loadUserRoutes} from './router/index.js'
import Prism from 'prismjs';
VMdEditor.use(vuepressTheme, {
  Prism,
});
const menus = JSON.parse(localStorage.getItem('menus') || '[]')
if (menus.length) {
  // 注册动态路由
  await loadUserRoutes(menus)
}
const app =createApp(App)
const pinia = createPinia()
app.use(router).use(pinia).use(ElementPlus).use(VMdEditor).use(Permission)
app.mount('#app')
